﻿using Acaweb.Data.Contracts;
using Acaweb.Model;
using Acaweb.Service.Contracts;

namespace Acaweb.Service
{
    public class CustomerService : BaseService, ICustomerService
    {
        /// <summary>
        /// This field is inyected by IoC through the property.
        /// </summary>
        private ICustomerDao customerDao;

        public ICustomerDao CustomerDao {
            get { return customerDao; }
            set { customerDao = value; }
        }

        #region ICustomerService Members

        public int CreateCustomer(string Name, string LastName) {
            Customer customer = new Customer();
            customer.FirstName = Name;
            customer.LastName = LastName;

            CustomerDao.Save(customer);

            return customer.Id;
        }

        public void DeleteCustomer(int Id) {
            Customer customer = CustomerDao.GetById(Id);

            CustomerDao.Delete(customer);
        }

        #endregion
    }
}